
<head>
<meta charset="UTF-8">
</head>
<!-- BEGIN PAGE CONTAINER-->
<div class="container-fluid">
    <!-- BEGIN PAGE HEADER-->
    <div class="row-fluid">
        <div class="span12">
            <!-- BEGIN PAGE TITLE & BREADCRUMB-->
            <h3 class="page-title">财富 - GPS <small id="displayTitle"></small>
        </h3>
            <ul class="breadcrumb">
                <li><a href="#"><i class="icon-home"></i></a><span class="divider"></span></li>
                <li><a href="#">财富 - 路线设定</a> <span class="divider">&nbsp;</span></li>

        </ul> <!-- END PAGE TITLE & BREADCRUMB-->
    </div>
</div> <!-- END PAGE HEADER--> <!-- BEGIN PAGE CONTENT-->
    <div id="page" class="dashboard">
        <!-- Start cam building -->
        <div class="widget-body form">
            <form action="newPortifolio" class="form-horizontal" method="POST">
                <div cneass="row-fluid">
                    <div class="span6">
                        <!-- Start Portifio Summary-->
                        <div class="widget">
                            <div class="widget-title">
                                <h4><i class="icon-filter"></i>定制您的投资组合-股票类资产</h4> <span class="tools"> <a href="javascript:;" class="icon-chevron-down"></a> <a href="javascript:;"
                                    class="icon-remove"
                                ></a>
                            </span>
                        </div>
                            <div class="widget-body" id="portifolioChart">
                                <div class="dataShow-item dataShow-border">
                                    <div class="title ui-clear">
                                        <h3 class="ui-left"><a href="http://fund.eastmoney.com/trade/zq.html?spm=001.2.swh">根据您的评估形成的股票基金池</a></h3> <a
                                        href="http://fund.eastmoney.com/trade/zq.html?spm=001.2.swh" class="ui-right ui-text-nounderline mouseLink"
                                    >更多</a>
                                        <p>选择基金进入您的投资组合</p>
                                </div>
                                    <div id="stockItems"></div>
                            </div>

                        </div>
                    </div>
                </div> <!-- End Portifio Summary-->
            </div>

                <div class="span6">
                    <!-- Start Portifio Summary-->
                    <div class="widget">
                        <div class="widget-title">
                            <h4><i class="icon-filter"></i>定制您的投资组合-债券类资产</h4> <span class="tools"> <a href="javascript:;" class="icon-chevron-down"></a> <a href="javascript:;"
                                class="icon-remove"
                            ></a>
                        </span>
                    </div>
                        <div class="widget-body" id="portifolioChart">
                            <div class="dataShow-item dataShow-border">
                                <div class="title ui-clear">
                                    <h3 class="ui-left"><a href="http://fund.eastmoney.com/trade/zq.html?spm=001.2.swh">根据您的评估形成的债券基金池</a></h3> <a
                                    href="http://fund.eastmoney.com/trade/zq.html?spm=001.2.swh" class="ui-right ui-text-nounderline mouseLink"
                                >更多</a>
                                    <p>选择基金进入您的投资组合</p>
                            </div>

                                <div id="bondItems"></div>

                        </div>
                    </div>
                </div> <!-- End Portifio Summary-->
            </div> <!-- End Portifio Summary-->
    </div> <!-- End cam building -->

        <button type="submit" class="btn btn-success" id="submit">确定投资路线</button>

        </form>
</div>
</div>
<!-- END PAGE CONTENT-->
</div>
<script src="../js/jquery-1.8.3.min.js"></script>   
<script>

var id, displayname;
$(document).ready(function(){	
	
	displayname=$("#displayname").val();
	id=$("#id").val();
    $("#displayTitle").append(displayname+"的财富目标设定");
   
var newPortifolioURL="/getNewPortifolio/"+id;
var stockHtml="";
var bondHtml="";
    	
$.ajax({
	type : "GET",
	contentType : "application/json",
	url : newPortifolioURL,
	dataType : 'json',
	timeout : 10000,
	success : function(data) {
		var stocks = data.stocks;
		var bonds = data.bonds;
		var cam =data.cam;
		
		for (var i in stocks){
			stock =stocks[i];			                                                 
			
			stockStr='<div class="content dataShow-itemA" > <ul>'+
			'<li><input type="radio" name="stockIntrumentId" value='+stock.financialintrumentid +' >'+
            stock.financialintrumentid + '</input>' +
            '<p>基金名称: <b class="up">'+stock.financialintrumentname+'</b></p>'+
            '<p>当期净值: <b class="up">'+stock.financialintrumentnetvalue+ '</b></p>'+
            '<p>晨星评级: <b class="up">'+stock.financialintrumentrate+ '</b></p>' +  
            '<p>风险评级: <b class="up">'+stock.riskrate+ '</b></p>'  +
            '<p>近1年表现: <b class="up">'+stock.yeartonowreturn+ '</b>%</p>'+
            '</li> </ul> </div>';
            
            
    stockHtml=stockHtml+stockStr;	
    $("#stockItems").empty();
    $("#stockItems").append(stockHtml);
  
		};
		
		for (var i in bonds){
			bond =bonds[i];			                                                 
			
			bondStr='<div class="content dataShow-itemA"> <ul>'+
			'<li><input type="radio" name ="bondIntrumentId" id="bondIntrumentId" value='+bond.financialintrumentid +' >'+
			bond.financialintrumentid + '</input>' +
            '<p>基金名称: <b class="up">'+bond.financialintrumentname +'</b></p>'+
            '<p>当期净值: <b class="up">'+bond.financialintrumentnetvalue + '</b></p>'+
            '<p>晨星评级: <b class="up">'+bond.financialintrumentrate + '</b></p>' +  
            '<p>风险评级: <b class="up">'+bond.riskrate + '</b></p>'  +
            '<p>近1年表现: <b class="up">'+bond.yeartonowreturn + '</b>%</p>'+
            '</li> </ul> </div>';
            
            
    bondHtml=bondHtml+bondStr;	
    $("#bondItems").empty();
    $("#bondItems").append(bondHtml);
  
		};

	},
	error : function(XMLHttpRequest, textStatus, errorThrown) {
		console.log(XMLHttpRequest.status);
		console.log(XMLHttpRequest.readyState);
		console.log(textStatus);
	},
	done : function(e) {
		console.log("done");
	}
}); 

        
 }); 
    
$("#submit").click(function(){	
	
	
	var saveNewPortifolioURL="/saveNewPortifolio/"+id;    
	
	
	var stockintrumentid= $('input:radio[name=stockIntrumentId]:checked').val();
	var bondintrumentid= $('input:radio[name=bondIntrumentId]:checked').val();
	var data={"stockintrumentid":stockintrumentid, "bondintrumentid":bondintrumentid};
	
	
	$.ajax({
		type : "POST",
		contentType : "application/json",
		url : saveNewPortifolioURL,
		data : JSON.stringify(data),
		dataType : 'json',
		timeout : 10000,
success : function(data) {
	$("#pageContainer").remove();	
	$("#main-content").load("pages/dashboardBody.html");	
			},
			error : function(e) {
				
				alert("error");
			},
			done : function(e) {
				alert("done");
			}
	});
	
	
	
	
	
}); 

 
   

    </script>
<!-- END PAGE CONTAINER-->